package dome2;

public class Text {
    public static void walk(IRunning running) {
        running.run();
    }
    public static void swim(ISwimming swimming) {
        swimming.swim();
    }
    public void fly(IFlying flying) {
        flying.fly();
    }
    public static void main(String[] args) {
//        Cat cat = new Cat("小猫");
//        walk(cat);
//        Frog frog = new Frog("小青蛙");
//        swim(frog);
//        Robot robot = new Robot("机器人");
//        //机器人不是动物，一样可以跑步
//        walk(robot);

        Animal animal = new Cat("小猫");// 因为是new 的子类的实例// 子类还重写了这个方法，所以就调用重写后的方法了
        animal.run();
    }
}
